package com.sld.concrete.algorithm.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.sld.concrete.algorithm.mapper.RecPlateAlgorithmMapper;
import com.sld.concrete.algorithm.domain.RecPlateAlgorithm;
import com.sld.concrete.algorithm.service.IRecPlateAlgorithmService;
import com.ruoyi.common.core.text.Convert;

/**
 * 算法系数Service业务层处理
 * 
 * @author topviewers
 * @date 2022-04-15
 */
@Service
public class RecPlateAlgorithmServiceImpl implements IRecPlateAlgorithmService 
{
    @Autowired
    private RecPlateAlgorithmMapper recPlateAlgorithmMapper;

    /**
     * 查询算法系数
     * 
     * @param id 算法系数主键
     * @return 算法系数
     */
    @Override
    public RecPlateAlgorithm selectRecPlateAlgorithmById(Long id)
    {
        return recPlateAlgorithmMapper.selectRecPlateAlgorithmById(id);
    }

    /**
     * 查询算法系数列表
     * 
     * @param recPlateAlgorithm 算法系数
     * @return 算法系数
     */
    @Override
    public List<RecPlateAlgorithm> selectRecPlateAlgorithmList(RecPlateAlgorithm recPlateAlgorithm)
    {
        return recPlateAlgorithmMapper.selectRecPlateAlgorithmList(recPlateAlgorithm);
    }

    /**
     * 新增算法系数
     * 
     * @param recPlateAlgorithm 算法系数
     * @return 结果
     */
    @Override
    public int insertRecPlateAlgorithm(RecPlateAlgorithm recPlateAlgorithm)
    {
        //判断是否已经有了对应的车牌号
        List list = recPlateAlgorithmMapper.queryByPlateNo(recPlateAlgorithm.getPlateNo());
        if (list == null || list.size() > 0) {
            return -1;
        }
        recPlateAlgorithm.setCreateTime(DateUtils.getNowDate());
        return recPlateAlgorithmMapper.insertRecPlateAlgorithm(recPlateAlgorithm);
    }

    /**
     * 修改算法系数
     * 
     * @param recPlateAlgorithm 算法系数
     * @return 结果
     */
    @Override
    public int updateRecPlateAlgorithm(RecPlateAlgorithm recPlateAlgorithm)
    {
        return recPlateAlgorithmMapper.updateRecPlateAlgorithm(recPlateAlgorithm);
    }

    /**
     * 批量删除算法系数
     * 
     * @param ids 需要删除的算法系数主键
     * @return 结果
     */
    @Override
    public int deleteRecPlateAlgorithmByIds(String ids)
    {
        return recPlateAlgorithmMapper.deleteRecPlateAlgorithmByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除算法系数信息
     * 
     * @param id 算法系数主键
     * @return 结果
     */
    @Override
    public int deleteRecPlateAlgorithmById(Long id)
    {
        return recPlateAlgorithmMapper.deleteRecPlateAlgorithmById(id);
    }
}
